Skip to main content

Task Scheduler

Create task

Ref: New-ScheduledTask

Parameter

  • <program>
  • <arguments>
  • <user>
  • <task name>
Administrator PowerShell
$action = New-ScheduledTaskAction -Execute "`"<program>`"" -Argument "<arguments>"

$principal = New-ScheduledTaskPrincipal -UserId <user>

$trigger = New-ScheduledTaskTrigger -AtLogOn

$task = New-ScheduledTask -Action $action -Principal $principal -Trigger $trigger

Register-ScheduledTask -TaskName <task name> -InputObject $task